FROM node:14.21 AS builder
WORKDIR /app
COPY web/ /app
RUN ls
RUN npm install
RUN npm run build

# 第二个构建阶段：生产环境镜像
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY web/.docker-compose/nginx/conf.d/nginx.conf /etc/nginx/conf.d/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
